<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML>
<html>
<head>
    <base href="<%=basePath%>">

    <title>xtgl03003.jsp</title>

    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <%-- 引用layui.css --%>
    <link rel="stylesheet" type="text/css" href="js/layui/css/layui.css"/>

</head>

<body>
<%-- 退货详情信息 --%>
<div id="returnDetail">
    <form class="layui-form" action="" style="margin:40px;" name="my_form" id="my_form">
        <input type="hidden" id="order_id" name="order_id" value="">
        <input type="hidden" id="recordId" name="recordId" value="">
        <input type="hidden" id="deploy_info" name="deploy_info"  class="layui-input" title="配置信息">
        <%--<input  id="good_id" name="good_id" value=""   readonly >--%>
        <div class="layui-form-item">
            <label class="layui-form-label">商品名称：</label>
            <div class="layui-input-block">
                <input type="text" id="good_name" name="good_name" readonly class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">会员名称：</label>
            <div class="layui-input-block">
                <input type="text" id="user_name" name="user_name" readonly class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">地区名称：</label>
            <div class="layui-input-block">
                <input type="text" id="area_name" name="area_name" readonly class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">状态：</label>
            <div class="layui-input-block">
                <input type="text" id="state" name="state" readonly class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">是否发货：</label>
            <div class="layui-input-block">
                <input type="text" id="is_delivery" name="is_delivery" readonly class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">退货费用：</label>
            <div class="layui-input-block">
                <input type="text" id="returnCost" name="returnCost" readonly class="layui-input">
            </div>
        </div>
    </form>
</div>
<script type="text/javascript" src="js/layui/layui.js"></script>
<script type="text/javascript">
    layui.config({
        base: "<%=basePath%>/js/common/"
    }).use(["common", "element", "layer", "form", "table", "jquery"], function () {
        var elem = layui.element;
        var layer = layui.layer;
        var form = layui.form;
        var table = layui.table;
        var $ = layui.jquery;

        layui.common.init();
        var orderId = $('#order_id').val();
        //页面一加载就发送ajax
        $(function () {
            //console.log(orderId);
            $.ajax({
                url: "DDGL060/returnDetail.do",
                type: "post",
                data: {orderId: orderId},
                datType: "json",
                success: function (data) {
                    //console.log("值返回成功！")
                   // console.log(data)
                    if (data.code == '200') {
                        //console.log("值返回成功！")
                        $('#good_name').attr("value", data.data[0].goodsName);
                        $('#area_name').attr("value", data.data[0].areaName);
                        $('#good_num').attr("value", data.data[0].goodsNum);
                        $('#recordId').attr("value", data.data[0].recordId);

                        if (data.data[0].isDelivery == 0) {
                            $('#is_delivery').attr("value", "未发货")
                        } else if (data.data[0].isDelivery == 1) {
                            $('#is_delivery').attr("value", "已发货");
                        }
                        var deployInfo = data.data[0].deployInfo;
                        var returnCost = data.data[0].returnCost;
                        $('#deploy_info').attr('value',deployInfo);

                        if ( returnCost==null || returnCost=="" || returnCost=='undefined') {
                            $('#returnCost').attr("value", deployInfo+' 积分')
                        } else  {
                            $('#returnCost').attr("value", returnCost+' 积分');
                        }
                        if (data.data[0].state == 0) {
                            $('#state').attr("value", "已取消");
                        } else if (data.data[0].state == 1) {
                            $('#state').attr("value", "已确认");
                        } else if (data.data[0].state == 2) {
                            $('#state').attr("value", "已退货");
                        }
                    } else {
                        layer.msg(data.message, {icon: 5, time: 2000});
                    }
                }
            });
        });
    });

</script>
</body>
</html>
